<?php
if(@$_POST['open']!='please'){
	exit;
}
session_start();
include_once("../../php/include_all.php");
?>
<div class="box span12 geo-box">
	<div class="box-header well">
    	<H2>Setting User</H2>
    </div>
    <div class="box-content">
    	<div class="accordion" id="accordion2">
        	<div class="accordion-group">
            	<form id="form_edit" class="form-horizontal"  method="post" action="">
            	<input type="hidden" name="idakun" id="idakun" value="<?php echo musrenbang_akun;?>">
                <table class="table-form">
                	<tr>
                    	<td>Username</td><td>:</td>
                        <td><input type="text" name="user" id="user" value="<?php echo musrenbang_username;?>"></td>
                    </tr>
                	<tr>
                    	<td>Password</td><td>:</td>
                        <td><input type="Password" name="pass" id="pass" value="<?php echo musrenbang_pass;?>"></td>
                    </tr>
                	<tr>
                    	<td> Nama Penanggung Jawab</td><td>:</td>
                        <td><input type="text" name="pj" id="pj" value="<?php echo musrenbang_pj;?>"></td>
                    </tr>
                	<tr>
                    	<td>NIP</td><td>:</td>
                        <td><input type="text" name="nip" id="nip" value="<?php echo musrenbang_nip;?>"></td>
                    </tr>
                </table>
                <table align="right">
                
                	<tr>
                    	<td>
                        	<a class="btn btn-primary bt-simpan-user" div id="loader" style="margin-top:2px"></div>&nbsp;Ubah</a>
                        </td>
                    </tr>
                </table>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
var urls='BAPPEDA/edit_user/aksi.php';
$('.bt-simpan-user').click(function(){
	var btn = $(this);
	var load = $('#loader');
	var rslt = $('#result');
	load.addClass('spinner pull-left');
	btn.removeClass('btn-primary').addClass('btn-info');
	
	var form = $('#form_edit');
	var data = form.serializeArray();
	var post = $.post(urls,data);
	
	post.done(function(res){
		var result = res.split('__');
		if(result.length==2){
			if(result[0]=='success'){
				rslt.html('<font color="green">Tersimpan</font>');
				setTimeout(function() {
					rslt.html('');
				},1500);
			}else{
				rslt.html('<font color="red">'+res+'</font>');
			}
		}else{
			rslt.html('<font color="red">'+res+'</font>');
		}
		load.removeClass();
		btn.removeClass('btn-info').addClass('btn-primary');
	});
});

</script>